<%@ page language="java" %>
<%@ page import="java.util.Hashtable,
                 ro.gateway.aida.utils.HttpUtils,
                 ro.gateway.aida.usr.LoginServlet,
                 ro.gateway.aida.usr.UserConstants,
                 ro.gateway.aida.obj.Organization,
                 ro.gateway.aida.usr.User,
                 ro.gateway.aida.usr.UserUtils,
                 ro.gateway.aida.srv.EditorServlet,
                 ro.xblue.translator.LanguageBean,
                 ro.xblue.translator.TranslatorUtils,
                 ro.gateway.aida.obj.Person,
                 java.util.Enumeration,
                 ro.gateway.aida.usr.Arbiter,
                 ro.gateway.aida.usr.Perms,
                 ro.gateway.aida.db.PersistenceToken,
                 ro.gateway.aida.db.PersistenceManager,
                 java.util.Iterator,
                 ro.gateway.aida.utils.IDString
"%>

<%@ taglib uri="/WEB-INF/taglib.tld" prefix="gtw" %>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<%@ taglib uri="/WEB-INF/usr.tld" prefix="usr" %>


<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
 <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
<title>View Person</title>
<link rel="stylesheet" href="alf.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" class=text>
<%
Hashtable bean=EditorServlet.getBean(request);
Person pers=(Person)bean.get("pers");
LanguageBean lang_bean = TranslatorUtils.getCurrentLanguage(request, application);
String lang=lang_bean.language;
User user = UserUtils.getLogged(request,response);
String ctx = request.getContextPath();
String mode=(String)request.getAttribute("mode");

Arbiter ar=Arbiter.getManager(PersistenceManager.tokenLookup(application));
%>

<%if("list".equals(mode)) {%>
   <% pageContext.include("../header.jsp"); %>
<%}%>

<trans:initPage module="pers" />
<table width="98%" border="0" cellspacing="1" cellpadding="2" class="text_search" bgcolor="#3399CC" align="center">
    <tr> 
      <th colspan="2" class=textalb bgcolor="3399CC"><trans:showPageMessage label="pers.view" /></th>
    </tr>
    <tr> 
      <td width="30%" bgcolor="ffffff"><trans:showPageMessage label="pers.fullname" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"> <%=pers.getName()%></td>
    <tr> 
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.domain" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=pers.getDepartment()%></td>
    </tr>
    <tr> 
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.country" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=pers.getCountryName()%></td>
    </tr>
    <tr> 
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.state" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=HttpUtils.strPrint(pers.getState(),"")%></td>
    </tr>
    <tr> 
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.address" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=HttpUtils.strPrint(pers.getAddress(),"")%></td>
    </tr>
    <tr>
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.phone" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=HttpUtils.strPrint(pers.getPhone(),"")%></td>
    </tr>
    <tr>
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.fax" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><%=HttpUtils.strPrint(pers.getFax(),"")%></td>
    </tr>
    
    <tr>
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.email" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold"><a href="mailto:<%=pers.getEmail()%>"><%=HttpUtils.strPrint(pers.getEmail(),"")%></a></td>
    </tr>
    <tr>
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.assignedToOrgs" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold">
		<% 
		Iterator ip=pers.getAssignedToOrgs().iterator();
		while (ip.hasNext()) {
			IDString o = (IDString) ip.next();
		%>
    <a href=# onclick="javascript:window.open('<%=ctx%>/org/view?id=<%=o.getId()%>', 'org_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
      <%=o.getText()%></a> <%if(ip.hasNext()) {%>,<%}%>
		<%
		}
		%>
	</td>
    </tr>
	<tr>
      <td width="30%" bgcolor="#FFFFFF"><trans:showPageMessage label="pers.url" />:</td>
      <td bgcolor="#FFFFFF" class="text_searchbold">
      <% if (pers.getURL()!=null && pers.getURL().length()!=0) { %>
      <a href="<%=HttpUtils.strPrint(pers.getURL(),"")%>" target=_blank>
      <%=HttpUtils.strPrint(pers.getURL(),"")%>
      </a>
      <%}%>
      </td>
    </tr>	
	<%if(ar.canDo(request,Perms.EDIT_OBJECT,pers.getId(),Arbiter.PERSON_TYPE)) {%>
<tr bgcolor="#FFFFFF">
	<td  bgcolor="#f9f9f9" width="30%" class="text_searchbold">
		<a href=<%=ctx%>/pers/edit?action=edit&persid=<%=pers.getId()%> 
		<% if(!"list".equals(mode)) {%>target="_blank"<%}%>
		><trans:showPageMessage label="pers.editinfo" /></a>
	</td><td bgcolor="#f9f9f9">&nbsp;</td>
	</tr>
	<%}%> 
  </table>

<%if("list".equals(mode)) {%>
   <% pageContext.include("../footer.jsp"); %>
<%}%>

</body>
 <HEAD> 
 <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
 </HEAD> 
</html>